<!--Descriptive page name, messages and instructions-->
<% if logged_in_as_admin?  %>
<h2><%= t('.create_more', :default => 'Create more invitations for this user') %></h2>
  <%= form_tag user_invitations_url(@user) do %>
    <p><%= label_tag :number_of_invites, t('.number_of_invites', :default => 'Number of invitations:') %> <%= text_field_tag :number_of_invites  %> <%= submit_tag 'Create' %></p>
  <% end %> 
<% end %>
  
<h2>Invite a friend</h2>
<!--/descriptions-->

<!--subnav-->
<h3 class="landmark">Actions</h3>
<ul class="navigation" role="navigation">
  <li><%= link_to "Manage invitations", {:controller => :invitations, :action => :manage, :user_id => @user.login} %></li>
  <li><%= link_to "Request more", new_user_invite_request_path %></li>
</ul>

<!--/subnav-->

<!--main content-->
<div class="module">
<% if @unsent_invitations.blank? %>
  <p>Sorry, you have no unsent invitations right now.</p>  
<% else %>
  <p>You have <%= @user.invitations.unsent.count.to_s %> open invitations and <%= @user.invitations.unredeemed.count.to_s %> that have been sent but not yet used.</p>
  <%= form_tag url_for(:controller => 'invitations', :action => 'invite_friend', :user_id => @user) do %>
    <dl>
      <dt><%= label_tag :invitee_email, t('.email address', :default => 'Email address') %></dt>
      <dd><%= text_field_tag :invitee_email %></dd>
      <dt><%= label_tag :id, t('.choose_invite', :default => 'Choose an invitation') %></dt>
      <dd>
        <ul>
          <% for unsent_invite in @unsent_invitations %>
          <li>
            <%= radio_button_tag 'id', unsent_invite.id, (unsent_invite == @unsent_invitations.first) %> 
            <%= label_tag 'id_' + unsent_invite.id.to_s, unsent_invite.token %>
          </li>
          <% end %>        
        </ul>
      </dd>
    </dl>
    <p class="submit"><%= submit_tag t('.submit_invite', :default => 'Send invite')  %></p>
  <% end %>
<% end %>
</div>
<!--/content-->

<!--subnav-->
<!--/subnav-->
